import { Inject, Provide } from '@midwayjs/core'
import { Context } from '@midwayjs/koa'

@Provide()
export class StateService {
  @Inject()
  ctx: Context

  setJwtPayload(payload: any) {
    this.ctx.state.jwtPayload = payload
  }

  getJwtPayload(): IJwtPayload {
    return this.ctx.state.jwtPayload
  }
}
